<%@page import="com.ilibrary.constants.MyConstants"%>
<%@page import="com.ilibrary.web.vo.UserInfoVO"%>
<%@page import="com.ilibrary.web.vo.BookVO"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>馆藏搜索</title>
<%@include file="../_common.jsp" %>
<link href="<%=request.getContextPath()%>/template_css/index/index.css" rel="stylesheet" type="text/css">
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/template_css/search/base.css">
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/template_css/search/main.css">
</head>
<%
	List<BookVO> bookVOList = (List<BookVO>) request.getAttribute("bookVOList");
	String keywords = (String) request.getAttribute("keywords");
	int totalPages = (Integer) request.getAttribute("totalPages");
	int currentPage = (Integer) request.getAttribute("currentPage");
%>
<body>
	<%@include file="header.jsp" %>
	<div id="content" style="height: auto;overflow: hidden;">
		<div style="padding-top: 5px;">
			<div id="left_content" style="height: 500px;">
				<div class="left_content_line">
					<h4>检索范围分布</h4>
					<dl class="s_l_list">
						<dt>
							<strong>馆藏地： </strong>
						</dt>
						<dd>
							·<a href="javascript: void()">航空港</a>(17)
						</dd>
						<dd>
							·<a href="javascript: void()">龙泉</a>(11)
						</dd>
					</dl>
					<dl class="s_l_list">
						<dd>
							<b>分类：</b>
						</dd>
						<dd>
							·<a href="javascript: void()">历史、地理</a>(23)
						</dd>
						<dd>
							·<a
								href="javascript: void()">文学</a>(11)
						</dd>
						<dd>
							·<a href="javascript: void()">政治、法律</a>(2)
						</dd>
						<dd>
							·<a href="javascript: void()">哲学、宗教</a>(2)
						</dd>
						<dd>
							·<a href="javascript: void()">天文学、地球科学</a>(2)
						</dd>
						<dd>
							·<a href="javascript: void()">文化、科学、体育</a>(1)
						</dd>
					</dl>
					<dl class="s_l_list">
						<dt>
							<strong>文献类型： </strong>
						</dt>
						<dd>
							·<a href="javascript: void()">中文图书</a>(29)
						</dd>
						<dd>
							·<a href="javascript: void()">中文连续出版物</a>(2)
						</dd>
						<dd>
							·<a href="javascript: void()">民国文献</a>(1)
						</dd>
					</dl>
					<dl class="s_l_list">
						<dt>
							<strong>主题：</strong>
						</dt>
						<dd>
							·<a href="javascript: void()">中国</a>(8)
						</dd>
						<dd>
							·<a href="javascript: void()">长篇小说</a>(3)
						</dd>
						<dd>·<a href="javascript: void()">成功心理</a>(2)
						</dd>
					</dl>
				</div>
			</div>

			<div id="book_content">
				<div style="height: 30px;font-size: 14px;">
					<div style="float: left;height: 30px;line-height: 30px;">
						搜索条件：<font color="green"><%=keywords %></font>
						<input name="title" id="keywords" value="<%=keywords %>" type="hidden">&nbsp;
					</div>
					<div style="float: right;height: 30px;line-height: 30px;">
					<%
						if(currentPage == 1) {
							if(totalPages <= 1) {
								if(totalPages == 0) {
							%>
								<span style="color: #CCC">上一页 </span>&nbsp;
								第<font color="red">0</font>页/共<font color="black">0</font>页&nbsp;
								<span style="color: #CCC">下一页</span>
							<%
								}else {
							%>
								<span style="color: #CCC">上一页 </span>&nbsp;
								第<font color="red"><%=currentPage %></font>页/共<font color="black"><%=totalPages %></font>页&nbsp;
								<span style="color: #CCC">下一页</span>
							<%
								}
							}else {
					%>
							<span style="color: #CCC">上一页 </span>&nbsp;
							第<font color="red"><%=currentPage %></font>页/共<font color="black"><%=totalPages %></font>页&nbsp;
							<a style="color: blue;" href="javascript: void(0)" onclick="toPage(<%=currentPage+1%>)">下一页</a>
					<%
							}
						}else {
							if(currentPage == totalPages) {
					%>
							<a style="color: blue;" href="javascript: void(0)" onclick="toPage(<%=currentPage-1%>)">上一页 </a>&nbsp;
							第<font color="red"><%=currentPage %></font>页/共<font color="black"><%=totalPages %></font>页&nbsp;
							<span style="color: #CCC">下一页</span>
					<%		
							}else {
					%>
							<a style="color: blue;" href="javascript: void(0)" onclick="toPage(<%=currentPage-1%>)">上一页 </a>&nbsp;
							第<font color="red"><%=currentPage %></font>页/共<font color="black"><%=totalPages %></font>页&nbsp;
							<a style="color: blue;" href="javascript: void(0)" onclick="toPage(<%=currentPage+1%>)">下一页</a>
					<%			
							}
						}
					%>
						到第<select name="topage" size="1" onchange="toSelectPage(this)">
								<%
									for(int i=1;i<=totalPages;i++) {
										if(i == currentPage) {
								%>
									<option selected="selected"><%=i %></option>
								<%
										}else {
								%>
									<option><%=i %></option>
								<%
										}
									}
								%>
							</select>页
					</div>
				</div>
				
				<%
					if(bookVOList.size() == 0) {
				%>
					<div class="list_books" id="list_books" style="clear: both;">
						请输入书名或作者等
					</div>
				<%		
					}else {
						for(int i=0;i<bookVOList.size();i++) {
							BookVO bookVO = bookVOList.get(i);
						%>
						<div class="list_books" id="list_books" style="clear: both;">
							<h3>
								<span class="doc_type_class"><%=bookVO.getCategoryName() %></span>
								<a href="<%=request.getContextPath() %>/book/bookItem.action?bookId=<%=bookVO.getBookId()%>" target="_blank">
									<b><%=(currentPage-1)*MyConstants.CLIENT_SEARCH_BOOK_PAGE_SIZE+i+1 %>.
										<em style="color: #F00;"><%=bookVO.getBookName()%></em></b> 
								</a> ID：<%=bookVO.getBookId() %>
							</h3>
							<p>
								<span>
									<strong>馆藏复本：</strong>1 <br> 
									<strong>可借复本：</strong>0
								</span> 
								<%=bookVO.getBookAuthor() %>&nbsp;&nbsp;著 <br> 
								<%=bookVO.getBookPubHouse() %>&nbsp;
								<%=bookVO.getBookPubDt() %>
							</p>
						</div>
						<%
						}
					}
				%>
				
				<div style="height: 30px;font-size: 14px;">
					<div style="float: right;height: 30px;line-height: 30px;">
					<%
						if(currentPage == 1) {
							if(totalPages <= 1) {
								if(totalPages == 0) {
							%>
								<span style="color: #CCC">上一页 </span>&nbsp;
								第<font color="red">0</font>页/共<font color="black">0</font>页&nbsp;
								<span style="color: #CCC">下一页</span>
							<%
								}else {
							%>
								<span style="color: #CCC">上一页 </span>&nbsp;
								第<font color="red"><%=currentPage %></font>页/共<font color="black"><%=totalPages %></font>页&nbsp;
								<span style="color: #CCC">下一页</span>
							<%
								}
							}else {
					%>
							<span style="color: #CCC">上一页 </span>&nbsp;
							第<font color="red"><%=currentPage %></font>页/共<font color="black"><%=totalPages %></font>页&nbsp;
							<a style="color: blue;" href="javascript: void(0)" onclick="toPage(<%=currentPage+1%>)">下一页</a>
					<%
							}
						}else {
							if(currentPage == totalPages) {
					%>
							<a style="color: blue;" href="javascript: void(0)" onclick="toPage(<%=currentPage-1%>)">上一页 </a>&nbsp;
							第<font color="red"><%=currentPage %></font>页/共<font color="black"><%=totalPages %></font>页&nbsp;
							<span style="color: #CCC">下一页</span>
					<%		
							}else {
					%>
							<a style="color: blue;" href="javascript: void(0)" onclick="toPage(<%=currentPage-1%>)">上一页 </a>&nbsp;
							第<font color="red"><%=currentPage %></font>页/共<font color="black"><%=totalPages %></font>页&nbsp;
							<a style="color: blue;" href="javascript: void(0)" onclick="toPage(<%=currentPage+1%>)">下一页</a>
					<%			
							}
						}
					%>
						到第<select name="topage" size="1" onchange="toSelectPage(this)">
								<%
									for(int i=1;i<=totalPages;i++) {
										if(i == currentPage) {
								%>
									<option selected="selected"><%=i %></option>
								<%
										}else {
								%>
									<option><%=i %></option>
								<%
										}
									}
								%>
							</select>页
					</div>
				</div>
				
			</div>
		</div>
		<div style="width: 100%;height: 30px;clear: both;"></div>
	</div>
	<%@include file="footer.jsp" %>
</body>

<script type="text/javascript">

	function toPage(topage) {
		location.href = "<%=request.getContextPath() %>/book/doSearchBooks.action?keywords=<%=keywords%>&currentPage="+topage;
	}
	function toSelectPage(select) {
		var toPage = select.value;
		location.href = "<%=request.getContextPath() %>/book/doSearchBooks.action?keywords=<%=keywords%>&currentPage="+toPage;
	}
	function check_user() {
		var userId = $('#userId').val();
		var userPassword = $('#userPassword').val();
		if(userId == null || userId == '') {
			alert("请输入有效登录学号！");
			$('userId').focus();
			return false;
		}
		if(userPassword == null || userPassword == '') {
			alert("请输入有效登录密码！");
			$('userPassword').focus();
			return false;
		}
		$('#clientLoginForm').submit();
	}
</script>

</html>